import requests from "./request"
import type { addFormType, mailType } from "../types"
// 添加商品
export const addGoodApi = (data: addFormType) => requests.post("/goods", data)
// 获取商品列表
export const getGoodApi = (data: object) => requests.get("/goods", { params: data })
// 删除商品
export const delGoodApi = (id: number) => requests.delete(`/goods/${id}`)
// 修改商品
export const updateGoodApi = (data: addFormType) => requests.patch(`/goods/${data.id}`, data)
// 获取所有物品
export const getArticleApi = () => requests.get("/article")
// 添加邮件
export const addMailApi = (data: object) => requests.post("/mail", data)
// 获取邮件列表
export const getMailApi = () => requests.get("/mail")
// 删除邮件
export const delMailApi = (id: number) => requests.delete(`/mail/${id}`)
// 修改邮件
export const updateMailApi = (data: mailType) => requests.patch(`/mail/${data.id}`, data)
// 添加奖励物品
export const addPrizesApi = (data: object) => requests.post("/mail/add/prizes", data)